<template>
	<view class="subaccount">
		<!-- 顶部导航 -->
		<diyNavBar value='创建子账户'></diyNavBar>
		<view class="textbox ">
			<input type="number" v-model="setData.mobile" placeholder="输入手机号"/>
		</view>
		<view class="textbox topnone">
			<input type="text" v-model="setData.password" placeholder="输入密码"/>
		</view>
		<view class="textbox topnone hover" @click="btn">
			创建账户
		</view>
	</view>
</template>

<script>
	import diyNavBar from '../../component/diy-nav/diy-navbar.vue'
	export default{
		components:{diyNavBar},
		data(){
			return {
				setData:{
					mobile:'',password:''
				},
				judge:false
			}
		},
		methods:{
			btn(){
				if(!this.setData.mobile || !this.setData.password) {
					uni.showToast({
						title:'输入请勿为空',
						icon:'none'
					})
					return false;
				}
				if(this.judge) return false;
				this.$http.sendrequest('/member/Addrights',this.setData,{tokenJudge:true}).then(res=>{
					uni.showToast({title:res.msg,icon:'none'})
					if(res.code == 1){
						this.judge = true;
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},1000)
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.textbox{
		background: #F2F2F2;
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		margin: 172rpx  70rpx 72rpx 70rpx;
		border-radius: 100rpx;
		input{
			width: 90%;
			height: 90%;
			font-size: 28rpx;
		}
	}
	.topnone{
		margin-top:0 ;
	}
	.hover{
		background: #FF6F30;
		color: #FFFFFF;
		font-size: 28rpx;
		font-weight: bold;
	}
</style>
